package ufrgs.inf.delphos.extraction.java;

import java.io.File;

import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.dom.CompilationUnit;

import ufrgs.inf.delphos.extraction.model.DCompilationUnit;
import ufrgs.inf.delphos.extraction.model.DelphosSystemModelController;

public class JavaExtractor {
	
	private JavaParser parser;
	private JavaASTVisitor javaASTVisitor;
	private DelphosSystemModelController delphosController;
	
	public JavaExtractor() {
		
		parser = new JavaParser();
		delphosController = new DelphosSystemModelController();
		javaASTVisitor = new JavaASTVisitor(delphosController);
	}
	
	
	public void processSelectedElements() {
		
		File javaFile = new File("E://CiC//TG//runtime-delphos//PizzariaSelau//src//entities//Message.java");
		
		
		CompilationUnit compilationUnit = parser.createAST((ICompilationUnit) javaFile);
		DCompilationUnit compUnit = delphosController.createCompilationUnit((ICompilationUnit) javaFile);
		javaASTVisitor.setCurrentCompilationUnit(compUnit);
		compilationUnit.accept(javaASTVisitor);
		
	}
	
	
	public static void main(String args[]) {
		
		JavaExtractor javaExtractor = new JavaExtractor();
		javaExtractor.processSelectedElements();
		
	}
	
}
